/* lsd.t   ADDRESS LIST DETAIL DELETE TRIGGER                         */
/*Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                 */
/*All rights reserved worldwide.  This is an unpublished work.        */
/*V8:ConvertMode=NoConvert*/
/*********************************************************************/
/*  Program :lsd.t                                                   */
/*  Author  :Fred Yeadon                                             */
/*  Date    :08/01/96                                                */
/*  !Description : ls_mstr DELETE trigger program                    */
/*          : In order to enhance this trigger to support specific   */
/*          : interfaces, add a DO-END block to (1) check for the    */
/*          : need to continue processing; (2) move the relevant     */
/*          : fields to an appropriate work area; and (3) call       */
/*          : one or more subprograms to continue processing.        */
/*          : This .t program should remain short, relying on        */
/*          : subprograms to perform most of the work.               */
/*********************************************************************/
/*                             MODIFY LOG                            */
/*********************************************************************/
/*Revision 8.5          Last Modified:  07/27/96 BY: fwy     *J12B*  */
/*Revision 8.5          Last Modified:  08/16/96 BY: deg     *J145*  */
/*Revision 8.5          Last Modified:  01/07/97 BY: jpm     *J1DM*  */
/*Revision 9.1          Last Modified:  08/13/00 BY: *N0KR* myb       */
/*                                                                   */
/*********************************************************************/

TRIGGER PROCEDURE FOR DELETE OF LS_MSTR.

/* To be developed in a future MFG/PRO release */

/*J145*/ {mfdeclre.i}
/*J145*/ define new shared work-table wf_old_ls_mstr like ls_mstr.
/*J145*/ define new shared variable w-recid as recid.
/*J145*/ define variable w-file as character format "x(24)".

/*J145*/ WI: /* Warehousing Interface processing                              */
/*J145*/ do:
            /* If there's no active external warehouse flagged to receive     */
            /* customer, supplier or ship-to export transactions,             */
            /* do not process                                                 */
/*J145*/    if not can-find(first whl_mstr no-lock
/*J145*/       where whl_mstr.whl_act
/*J145*/          and (whl_mstr.whl_cust_exp or whl_mstr.whl_sup_exp))
/*J145*/    then leave WI.

            /* If this is not a supplier,customer or ship-to deletion,        */
            /* do not process.                                                */
/*J145*/    if (ls_mstr.ls_type = "supplier")
/*J145*/       or (ls_mstr.ls_type = "customer")
/*J145*/       or (ls_mstr.ls_type = "ship-to")
/*J145*/    then do:

               /* Move key ls_mstr values to work table for processing        */
/*J145*/       assign w-recid = recid(ls_mstr).
/*J145*/       create wf_old_ls_mstr.
/*J145*/       if recid(wf_old_ls_mstr) = -1 then .
/*J145*/       assign
/*J145*/          wf_old_ls_mstr.ls_addr = ls_mstr.ls_addr
/*J145*/          wf_old_ls_mstr.ls_type = ls_mstr.ls_type.

               /* Call subprogram to create export transactions for warehouse */
/*J145*/       w-file = "wilsd.p".
/*J1DM*/ /*    {gprun.i ""wilsd.p""} */
/*J1DM*/       {gprunmo.i &module="WI"
                          &program="wilsd.p"}
/*J145*/    end.

/*J145*/ end. /* WI */
